﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ParticleRandomPlay : MonoBehaviour {

	public ParticleSystem ps;

	public float maxDelay = 0f;

	void OnEnable()
	{
		if (maxDelay > 0)
		{
			float delayTime = Random.Range (0f, maxDelay);
			Invoke ("Play", delayTime);
		} else
		{
			ps.Play (true);
		}
	}

	void OnDisable()
	{
		CancelInvoke("Play");
	}

	// Use this for initialization
	void Play () {
		ps.Play (true);
	}
	
}
